<#ibizinclude>
./WF_VIEW_CONTENT.vue.ftl
</#ibizinclude>

	/**
     * 视图唯一标识
     *
     * @protected
     * @type {string}
     * @memberof ${srfclassname(view.name)}Base
     */
	protected viewtag: string = '${view.getId()}';

    /**
     * 视图名称
     *
     * @protected
     * @type {string}
     * @memberof ${srfclassname(view.name)}Base
     */ 
    protected viewName:string = "${view.getName()}";

    <#if view.getPSAppViewEngines()??>
    <#list view.getPSAppViewEngines() as engine>

    /**
     * 视图引擎
     *
     * @public
     * @type {Engine}
     * @memberof ${srfclassname(view.name)}Base
     */
    public ${engine.getName()?lower_case}: ${engine.getEngineType()}Engine = new ${engine.getEngineType()}Engine();
    </#list>
    </#if>

<#if view.getPSAppCounterRefs()??>
<#assign counterRefs = ''/>
<#list view.getPSAppCounterRefs() as singleCounterRef>
<#if singleCounterRef.getPSAppCounter()??>
<#assign appCounter = singleCounterRef.getPSAppCounter()/>
<#assign counterRefs>${counterRefs}this.${appCounter.getCodeName()?lower_case}counterservice<#if singleCounterRef_has_next>,</#if></#assign>

    /**
     * ${srfclassname('${appCounter.getCodeName()}')}CounterService计数器服务对象
     *
     * @type {${srfclassname('${appCounter.getCodeName()}')}CounterService}
     * @memberof ${srfclassname('${view.name}')}Base
     */
    public ${appCounter.getCodeName()?lower_case}counterservice: ${srfclassname('${appCounter.getCodeName()}')}CounterService = new ${srfclassname('${appCounter.getCodeName()}')}CounterService({ $store: this.$store,context:this.context,viewparams:this.viewparams});
</#if>
</#list>

    /**
     * 计数器服务对象集合
     *
     * @type {Array<*>}
     * @memberof ${srfclassname('${view.name}')}Base
     */    
    public counterServiceArray:Array<any> = [${counterRefs}];
</#if>

    /**
     * 引擎初始化
     *
     * @public
     * @memberof ${srfclassname(view.name)}Base
     */
    public engineInit(): void {
    <#if view.getPSAppViewEngines()??>
    <#list view.getPSAppViewEngines() as engine>
        this.${engine.getName()?lower_case}.init({
            view: this,
        <#if engine.getPSAppViewEngineParams()??>
            <#list engine.getPSAppViewEngineParams() as param>
            <#if param.getParamType() == "LOGIC" && param.getPSAppViewLogic()??>
            ${param.getName()?lower_case}: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
                this.${param.getPSAppViewLogic().getName()}(args,fullargs, params, $event, xData);
            },
            </#if>
            <#if param.getParamType() == "CTRL" && param.getPSControl()??>
            ${param.getName()?lower_case}: this.$refs.${param.getPSControl().getName()},
            </#if>
            <#if param.getParamType() == "VALUE" && param.getName() != "P2k" && param.getValue()??>
            ${param.getName()?lower_case}: '${param.getValue()}',
            </#if>
            </#list>
        </#if>
        <#if de??>
            keyPSDEField: '${appde.getCodeName()?lower_case}',
            <#if appde.getMajorPSAppDEField()??>
            majorPSDEField: '${appde.getMajorPSAppDEField().getCodeName()?lower_case}',
            </#if>
        </#if>
            isLoadDefault: <#if (view.isLoadDefault?? && !view.isLoadDefault()) || (view.isEnableQuickGroup?? && view.isEnableQuickGroup())>false<#else>true</#if>,
        });
    </#list>
    </#if>
    }
    <#if view.getPSDER1N?? && view.getPSDER1N()??>

    /**
     * 处理指定视图控制关系将父键转为父实体上下文
     *
     * @protected
     * @memberof ${srfclassname(view.name)}Base
     */
    public handleviewRes(): void {
    <#assign viewRes = view.getPSDER1N()/>
    <#if viewRes.getMajorPSDataEntity()??>
    <#assign majorAppDataEntity = viewRes.getMajorPSDataEntity() />
        if (this.context.srfparentkey) {
            Object.assign(this.context,{'${majorAppDataEntity.getCodeName()?lower_case}':this.context.srfparentkey});
        }
    </#if>
    }
    </#if>
    <#if view.getPSControls()??>
    <#list view.getPSControls() as ctrl>
    <#if ctrl.getControlType()??>
    <#if ctrl.getHookEventNames()??>
    <#list ctrl.getHookEventNames() as eventName>

    /**
     * ${ctrl.name} 部件 ${eventName?lower_case} 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof ${srfclassname(view.name)}Base
     */
    public ${ctrl.name}_${eventName?lower_case}($event: any, $event2?: any): void {
    <#if ctrl.getPSControlLogics(eventName)??>
    <#list ctrl.getPSControlLogics(eventName) as ctrlLogic>
    <#if ctrlLogic.getLogicType() == "APPVIEWENGINE" && ctrlLogic.getPSAppViewEngine()??>
        this.${ctrlLogic.getPSAppViewEngine().getName()}.onCtrlEvent('${ctrl.name}', '${eventName?lower_case}', $event);
    <#else>
        <#if ctrlLogic.getEventArg()?? && ctrlLogic.getEventArg()?length gt 0>
        if (Object.is($event.tag, '${ctrlLogic.getEventArg()}')) {
            this.${ctrlLogic.name}(null, '', $event2);
        }
        <#else>
        this.${ctrlLogic.name}($event, '', $event2);
        </#if>
    </#if>
    </#list>
    </#if>
    }
    </#list>
    </#if>
    </#if>
    </#list>
    </#if>
<#if view.getPSAppViewLogics()??>
<#list view.getPSAppViewLogics() as logic>
<#if logic.getLogicTrigger() == "CUSTOM" || logic.getLogicTrigger() == "CTRLEVENT">

${P.getLogicCode(logic, "LOGIC.vue").code}
</#if>
</#list>
</#if>

<#if view.getPSAppViewUIActions()??>
<#list view.getPSAppViewUIActions() as viewUIAction>
<#if viewUIAction.getPSUIAction()?? >
<#assign uiAction = viewUIAction.getPSUIAction()/>
<#if !P.exists("importService", uiAction.getFullCodeName(), "")>
<#-- 系统预置界面行为输入start -->
<#if !(uiAction.getPSAppDataEntity?? && uiAction.getPSAppDataEntity()??)>
${P.getLogicCode(uiAction, "LOGIC.vue").code}
</#if>
<#-- 系统预置界面行为输入end -->
</#if>
</#if>
</#list>
</#if>
<#--  视图独立定义的内容start  -->
<#if self_content??>

${self_content}
</#if>
<#--  视图独立定义的内容end  -->